package com.wanbangee.marksystem.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import com.wanbangee.marksystem.entities.StatisticsSubReport;

@Mapper
public interface StatisticsSubReportDao {

	/**查询此科目所有学生成绩
	 * @param examId
	 * @param subId
	 * @return
	 */
	public List<StatisticsSubReport> slectSubjectReportByExamIdAndSubId(@Param("examId")Integer examId,@Param("subId")Integer subId);
	
	/**查询指定班级此科目所有学生成绩
	 * @param examId
	 * @param subId
	 * @param claId
	 * @return
	 */
	public List<StatisticsSubReport> slectSubjectReportByExamIdAndSubIdAndClaId(@Param("examId")Integer examId,@Param("subId")Integer subId,@Param("claId")Integer claId);
	
	
	/**查询指定学生的科目成绩
	 * @param examId
	 * @param subId
	 * @param claId
	 * @param stuNmOrStuNo
	 * @return
	 */
	public List<StatisticsSubReport> slectSubjectReportByExamIdAndSubIdAndClaIdAndstuNmOrStuNo(@Param("examId")Integer examId,@Param("subId") Integer subId,@Param("claId")Integer claId,@Param("stuNmOrStuNo")String stuNmOrStuNo);
	
	/**查询各科平均分/总分
	 * @param examId
	 * @return
	 */
	public List<StatisticsSubReport> selectAvgAndTotal(@Param("examId")Integer examId);
	
	/**班级成绩分析功能:
	 * 查询班级考试信息  班级平均分 班级名称/班主任/人数
	 * @param graId 年级Id
	 * @param claId	班级Id
	 * @return
	 */
	public Map<String, Object> selectExamClassInfo(@Param("claId")Integer claId,@Param("examId")Integer examId);
	
	/**班级成绩分析功能:
	 * 根据班级id，考试id查询此班级的年级排名
	 * @param claId
	 * @param examId
	 * @return
	 */
	public int selectExamClassRank(@Param("claId")Integer claId,@Param("examId")Integer examId);
	
	/**班级成绩分析功能:
	 * 根据班级id ，本次的考试成绩发布时间 查询班级上一次考试的排名
	 * @param claId  班级ID
	 * @param addTime 本次考试成绩的发布时间
	 * @return
	 */
	public int selectExamClassFormerRank(@Param("claId")Integer claId,@Param("addTime")String addTime);
	
	
	/**教师讲卷-成绩与答案
	 * 
	 * 查询此考试的某班级的某科全部学生考试信息，如果有输入学号或者姓名则进行模糊查询
	 * @param examId
	 * @param claId
	 * @param subId
	 * @param stuNmOrStuNo
	 * @return
	 */
	public List<StatisticsSubReport> selectStuScoreAndAnswerSheet(@Param("examId")Integer examId,@Param("claId")Integer claId,@Param("subId")Integer subId,@Param("stuNmOrStuNo")String stuNmOrStuNo);
}
